//系统参数
var PageUart = {
    id: "PageUart", //页面id
    menu: "i18n.lan.menu.basic", //所属菜单(一级菜单名)
    title: "i18n.lan.menu.PageUart", //标题（二级菜单名）
    icon: "icon-me-setting", //图标
    refreshBtnCmd: "DUMP_CORE", //刷新按钮指令
    saveBtn: true, //保存按钮
    el: [ //控件
        {
            elname: "text",
            label: i18n.lan.PageUart.bps,
            endRow: true,
            attrs: { id: "uart_bps", dumpKey: "UART5", dumpParamIndex: 0, cmdKey: "UART5SET", getValue: "PageUart_getSetValue()" },
        },
        {
            elname: "combobox",
            label: i18n.lan.PageUart.parity,
            id: "uart_parity",
            items: "i18n.lan.PageUart.parityItems",
            endRow: true,
            attrs: { dumpKey: "UART5", dumpParamIndex: 1 },
        },
        {
            elname: "combobox",
            label: i18n.lan.PageUart.databit,
            id: "uart_databit",
            items: "i18n.lan.PageUart.databitItems",//items需要string
            endRow: true,
            attrs: { dumpKey: "UART5", dumpParamIndex: 2 },
        },
        {
            elname: "combobox",
            label: i18n.lan.PageUart.stopbit,
            id: "uart_stopbit",
            items: "i18n.lan.PageUart.stopbitItems",//items需要string
            endRow: true,
            attrs: { dumpKey: "UART5", dumpParamIndex: 3 },
        },
    ],
}
CmdPage.add(PageUart); //添加到页面管理

//获得设置的值
function PageUart_getSetValue() {
    if ($('#uart_bps').val()) {//打开页面时
        let bps = $('#uart_bps').val(); //取值
        let parity = $('#uart_parity').combobox('getValue'); //取值
        let databit = $('#uart_databit').combobox('getValue'); //取值
        let stopbit = $('#uart_stopbit').combobox('getValue'); //取值
        return bps + "," + parity + "," + databit + "," + stopbit;
    } else {
        if (Device.dumpData.has("UART5")) {
            return Device.dumpData.get("UART5");
        }
        return "";
    }
}